﻿@model Irandeb4.Models.Order

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {

    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Pedido</legend>
        <table>
        <tr>
            <td class="editor-label">
                @Html.LabelFor(model => model.CompanyId, "Company")
            </td>
            <td class="editor-field">
                @Html.DropDownList("CompanyId", String.Empty)
                @Html.ValidationMessageFor(model => model.CompanyId)
            </td>
        </tr>
        </table>
                @if (Model.Items != null) {
                    int count=0;
                    foreach (var item in Model.Items)
                    { 
                        @Html.Partial("_Item",Model.Items.ElementAt(count))
                        count++;
                    }
                }

                @Html.EditorFor(model => model.ItemToSave)


            <div align="right"><input type="submit" value="Agregar" name="action" /></div>
        
        <table>
        <tr>
            <td class="editor-label">
                @Html.LabelFor(model => model.OrderDate)
            </td>
            <td class="editor-field">
                @Html.EditorFor(model => model.OrderDate)
                @Html.ValidationMessageFor(model => model.OrderDate)
            </td>
        </tr>
        <tr>
            <td class="editor-label">
                @Html.LabelFor(model => model.OrderExpiration)
            </td>
            <td class="editor-field">
                @Html.EditorFor(model => model.OrderExpiration)
                @Html.ValidationMessageFor(model => model.OrderExpiration)
            </td>
        </tr>
        <tr>
            <td class="editor-label">
                @Html.LabelFor(model => model.GeneralDescription)
            </td>
            <td class="editor-field">
                @Html.EditorFor(model => model.GeneralDescription)
                @Html.ValidationMessageFor(model => model.GeneralDescription)
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <p align="right"><input type="submit" value="Crear" name="action"/></p>
            </td>
        </tr>
        </table>
    </fieldset>
}

